﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using BindToolkit.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using BindToolkit.Behaviors;

namespace SilverlightApplication1.Web
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name new "ErrorService" in code, svc and config file together.
   
    public class ErrorService : IErrorService
    {
        public void DoWork()
        {
            FaultException<IEnumerable<ValidationErrorInfo>> ex = new FaultException<IEnumerable<ValidationErrorInfo>>(
                new ValidationErrorInfo[] { FakeException("InnerInterval.Low", "Fake Exception!"), FakeException("OtherInfos[Persons][1].Name", "Fake Exception") }
                );
            throw(ex);
        }
        private ValidationErrorInfo FakeException(string field, string message)
        {
            return
                new ValidationErrorInfo
                {
                    Error = message,
                    Members = new string[] { field }
                };



        }
    }
}
